package com.training.java.core.collections.Set.Car;

import java.util.HashSet;
import java.util.Set;

//This Demo shows set does not accepts duplicates.

public class CarSetDemo {

	public static void main(String[] args) {
		Car focus = new Car("Ford", "Focus", 2013);
		Car accord = new Car("Honda","Accord", 2014);
		Car focus2 = new Car("Ford", "Focus", 2013);
		Car sedan = new Car("Benz", "E250", 2015);
		Car sedan2 = new Car("Benz", "E250", 2015);
		
		Set<Car> cars = new HashSet<Car>();
		
		cars.add(focus);
		cars.add(accord);
		cars.add(focus2);
		cars.add(sedan);
		cars.add(sedan2);
		
		
		for(Car aCar : cars){
			
			System.out.println("Make of the car = " + aCar.getMake());
			System.out.println("Model of the car = " + aCar.getModel());
			System.out.println("Year of the car = " + aCar.getYear());
		}
		
		

	}

}
